<form nz-form [formGroup]="validateForm" ngxsForm="user.passwordForm" [ngxsFormClearOnDestroy]="true"
      (ngSubmit)="submitForm()">

  <nz-form-item>
    <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="old">旧密码</nz-form-label>
    <nz-form-control [nzSm]="14" [nzXs]="24" nzErrorTip="请输入旧密码!">
      <input nz-input type="password" formControlName="old" id="old"/>
    </nz-form-control>
  </nz-form-item>

  <nz-form-item>
    <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="new" nzRequired>新密码</nz-form-label>
    <nz-form-control [nzSm]="14" [nzXs]="24" nzErrorTip="请输入新密码!">
      <input nz-input type="password" formControlName="new" id="new" (ngModelChange)="updateConfirmValidator()"/>
    </nz-form-control>
  </nz-form-item>

  <nz-form-item>
    <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="confirm" nzRequired>确认密码</nz-form-label>
    <nz-form-control [nzSm]="14" [nzXs]="24" [nzErrorTip]="errorTpl">
      <input nz-input type="password" formControlName="confirm" id="confirm"/>
      <ng-template #errorTpl let-control>
        <ng-container *ngIf="control.hasError('required')">请输入确认密码!</ng-container>
        <ng-container *ngIf="control.hasError('confirm')">
          两次密码不一致!
        </ng-container>
      </ng-template>
    </nz-form-control>
  </nz-form-item>

</form>
